import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main2 {
    static final int N=1010;
    static char[][]arr=new char[N][N];
    static char[][]dist=new char[N][N];
    static int n,m;
    static int x1,x2,y1,y2;
    static int []dx={0,0,1,-1};
    static int []dy={1,-1,0,0};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        x1=in.nextInt();
        y1=in.nextInt();
        x2=in.nextInt();
        y2=in.nextInt();

        for (int i=1;i<=n;i++){
            String line=in.next();
            for (int j=1;j<=m;j++){
                arr[i][j]=line.charAt(j-1);
            }
        }
            System.out.println();

    }
}